package cn.micro.keep.accounts.mapper;

import cn.micro.keep.accounts.entity.AccountDimUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 用户信息表 Mapper 接口
 * </p>
 *
 * @author 柘阳科技
 * @since 2023-12-09
 */
public interface AccountDimUserMapper extends BaseMapper<AccountDimUser> {

    @Select("select adu.* from account_dim_user adu\n" +
            "    left join account_dim_role_user adru on adu.id = adru.user_id\n" +
            "    left join account_dim_role adr on adru.role_id = adr.id where adr.code = 'MEMBER_ROLE' and (adu.username = #{value}  or adu.phone = #{value}  or adu.wx_openid = #{value} )")
    AccountDimUser queryByUsernameOrPhoneOrOpenId(String value);
}
